-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIRFLOW-3112] Fix SFTPHook not validating hosts by default #4085
Conversation
This change seems to make the tests fail with |
Hm, that's annoying, but makes sense. I'll update the tests either Thursday at the office or Saturday. |
Wait, in previous code,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just needs updating of tests. Other than that LGTM. Thanks @Gwildor
Well, I got a little bit more confused, and after reading the code again I agree that @johnchenghk01 is right. The two options are not the inverse as I thought, it's just the default that is different. So the current code does indeed work because of SSHHook's default. Which does beg the question if SSHHook's default is sensible. And also, whether SFTPHook should follow that default. I think the last one is very important, because the default behaviour of 1.10 is to fail when the host key validation failed, but I think the changes of #3945 would allow them to succeed in 2.0. So now I think SFTPHook should change the default value of |
The default should be to validate SSH host keys. |
Ok, I've updated the PR. By default the hook now validates the host keys, which is the same behaviour as 1.10. Note that this is different behaviour than the SSHHook, but it can be argued that the SSHHook is in the wrong there. The setting can be overridden using the deprecated |
Codecov Report
@@ Coverage Diff @@
## master #4085 +/- ##
=======================================
Coverage 76.67% 76.67%
=======================================
Files 199 199
Lines 16186 16186
=======================================
Hits 12411 12411
Misses 3775 3775
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Gwildor!
It was checking the deprecated ignore_hostkey_verification option and
setting the correct no_host_key_check option, but the ignore_* option
worked as the inverse of the no_* option, so it should test for
true
.Make sure you have checked all steps below.
Jira
Description
Tests
Commits
Documentation
Code Quality
flake8 airflow/contrib/hooks/sftp_hook.py